#ifndef _GENERICBUTTON_H
#define _GENERICBUTTON_H

#include "WPILib.h"

/*
 * GenericButton.h
 * 
 * generic types of buttons, which must have a boolean Get() routine
 * 
 * SO... we can use this class for any button (either on the robot or driver station)
 * 
 * There are three main classes and one wrapper class in this file, which each implement the GenericButton class:
 * 
 * ButtonFromGeneric
 * ButtonFromJoystick
 * ButtonFromDriverStation
 * ButtonFromDigitalInput
 * 
 */


class GenericButton
{
public:
	virtual bool Get() = 0;
};

class ButtonFromGeneric : public GenericButton
{
public:
	ButtonFromGeneric(GenericButton *button);
	bool Get();
	
private:
	GenericButton *m_button;
};


class ButtonFromDigitalInput : public GenericButton
{
public:
	// constructor, based on a digital input
	ButtonFromDigitalInput(DigitalInput *button);
	
	//constructor, based on a channel for a digital input
	ButtonFromDigitalInput(UINT32 channel);
	
	// constructor, based on a slot and channel for a digital input
	ButtonFromDigitalInput(UINT32 slot, UINT32 channel);
	
	// is the button on the digital input pressed?
	bool Get();
	
private:
	DigitalInput *m_button;
};


class ButtonFromDriverStation : public GenericButton
{
public:
	// constructor, based on a channel on the driver station
	ButtonFromDriverStation(UINT32 channel);
	
	// is the button on the driver station pressed?
	bool Get();
	
private:
	DriverStation *m_ds;
	UINT32 m_channel;
};

class ButtonFromJoystick : public GenericButton
{
public:
	// constructor, based on a button number on a joystick
	ButtonFromJoystick(Joystick *joystick, UINT32 button_number);
	
	// is the button on the joystick pressed?
	bool Get();
	
private:
	Joystick *m_joystick;
	UINT32 m_button_number;
};

#endif
